cmake_minimum_required(VERSION 3.10)
project(MAVLinkQtApp)

set(CMAKE_CXX_STANDARD 17)

find_package(Qt5 COMPONENTS Core Widgets REQUIRED)
find_package(Boost REQUIRED COMPONENTS system)
find_package(Threads REQUIRED) # 查找pthread库

# 设置自动处理 MOC、UIC 和 RCC（资源文件）
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)

include_directories(${Boost_INCLUDE_DIRS})
# 包含当前目录，以便找到头文件和 MOC 文件
include_directories(${CMAKE_CURRENT_BINARY_DIR})

add_executable(${PROJECT_NAME} main.cpp 
                                mainwindow.cpp 
                                mavlink_server.cpp 
                                tcp_server.cpp
                                controlW.cpp
                                dataView.cpp
                                mainwindow.h
                                mavlink_server.h
                                tcp_server.h
                                )
target_link_libraries(${PROJECT_NAME} Qt5::Core Qt5::Widgets ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
                                # 添加对 pthread 库的链接